import java.io.*;
public class Test {
 public static void main (String[] args) {
  try {
   BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(new File("newFile.txt")));
   bufferedWriter.write("Hello World");
   bufferedWriter.close();
  } catch (Exception e) {
   e.printStackTrace();
  } 
 }
}
 //PrintWriter out = null ;
 /*
 BufferedWriter out = null;
  try {
   out = new BufferedWriter(new FileWriter(new File("newFile.txt")));
   //out = new PrintWriter(new FileWriter("azertty.txt"));
   out.write("My testing");
   out.close();
  } catch (IOException e) {
   System.out.println(e.getMessage()); 
   e.printStackTrace();
  }
 */
 /* finally {
   if (out != null) {
    System.out.println("Closing PrintWriter");
    out.close();
   }
  }
  */
 
